from kivy.uix.floatlayout import FloatLayout

from amgineirc.view.channels.logView import LogView
from amgineirc.view.messageView import MessageView
from amgineirc.view.channels.sendView import SendView
from amgineirc.viewModel.channels.serverViewModel import ServerViewModel

"""
content for a notebook view
left-top = log view
right-top = users view
bottom = send view
"""
class ServerView(FloatLayout, MessageView):
    def __init__(self, server, appdata):
        FloatLayout.__init__(self, size_hint=(1.0, 1.0))
        MessageView.__init__(self)
        # the recieve view - top
        self.receive_view = LogView(size_hint=(1.0, 0.9),
                                    pos_hint={'x':0.0, 'y':0.1},
                                    maximum_log_count=20)
        self.add_widget(self.receive_view)
        # the send view - bottom
        self.send_view = SendView(size_hint=(1.0, 0.1),
                                  pos_hint={'x':0.0, 'y':0.0})
        self.add_widget(self.send_view)
        # initialize the view model
        self.view_model = ServerViewModel(self,
                                          self.send_view,
                                          self.receive_view,
                                          server,
                                          appdata)

    # view model methods for wrapper view not this view

    def vm_set_state(self, **kargs):
        # if 'connected' in kargs:
        # show connected
        pass
